for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
const { join } = require('path')
const loadRules = require('../../rules')
jest.mock('../../helper/rules')
jest
/** global: jest */
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.
const { getAllRuleName, load } = require('../../helper/rules')
describe('Rules helper', () => {
it('input is a file path', () => {
getAllRuleName.mockImplementation(() => ['a', 'b', 'c', 'd'])
load.mockImplementation(name => name)
const options = {
order: ['c', 'x', 'a'],
path: 'rules'
}
const expected = [
join(__dirname, '../../rules', 'c'),
join(__dirname, '../../rules', 'a')
]
const ruleFunc = loadRules(options)
expect(ruleFunc).toEqual(expected)
})
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.